update format specific handling. (#502)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Thu, 20 Feb 2020 14:48:28 +0000 (07:48 -0700)
committerGitHub <noreply@github.com>
Thu, 20 Feb 2020 14:48:28 +0000 (07:48 -0700)
commit533ba0bcefdd43ddca1e7889fdba5b19b46e19df
treeb04260c3be4f3d8ab93d86aa2256797e988c5d4f
parentdd6e0307392ab6b54c2ebce3c3dcb9f6ca704443
update format specific handling. (#502)

* update format specific handling.

Format specific allocate, copy, destroy functions use new/delete for
underlying data management.  Use brace intitializers for underlying
data.  Previous xmalloc/xcalloc and xfree were used.

Format specific copy functions use copy constructor of underlying data.

Format specific copy functions have a const source.

Format specific functions use static_cast instead of c-style casts.
This helps avoid casting away const accidentally.

When possible, assign the result of fs_chain_find to a const pointer.

Eliminate corruption of global lists by AN1 writer which was modifying
format specific data.  This also simplifies memomry management and
fixes a double delete.

Fix const correctness issues with an1 symbol lookup.

Correct an1 symbol lookup to avoid dependency on structure padding.

Catch make-an1sym.pl with an1sym.h.

* use reinterpret_cast w/ fs_chain_add fs_chain_find ...

instead of c-style casts.

* make format_specifc_data a base class

and the various flavors derived classes.

* use a QList for format_specific_data chains.

* split format specific defines ...

use reinterpret_cast to downcast format_specific_data.  dynamic_cast
is noticeably slower.

* add new formspec.h file.

* create FormatSpecificDataList class.

rename format specific related items.

* safety check for formspec nullptr function ptrs.

* replace format specific function pointers

with pure virtual clone function and dtor.
32 files changed:
CMakeLists.txt
GPSBabel.pro
Makefile.in
an1.cc
an1sym.h
bend.cc
defs.h
destinator.cc
formspec.cc
formspec.h [new file with mode: 0644]
g7towin.cc
garmin_fs.cc
garmin_fs.h
garmin_gpi.cc
garmin_txt.cc
gdb.cc
gpx.cc
gpx.h
html.cc
interpolate.cc
kml.cc
lowranceusr.cc
make-an1sym.pl
ozi.cc
random.cc
route.cc
src/core/xmltag.h
text.cc
unicsv.cc
waypt.cc
xcsv.cc
xmltag.cc